/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elaborate.tag_analysis.client.actions.ui.multiplefileselector;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author lendle
 */
public class MultipleFileSelectionModel extends AbstractTableModel{
    private List<MultipleFileSelectionConfEntry> multipleFileSelectionConfEntries=new ArrayList<MultipleFileSelectionConfEntry>();

    public List<MultipleFileSelectionConfEntry> getMultipleFileSelectionConfEntries() {
        return multipleFileSelectionConfEntries;
    }

    public void setMultipleFileSelectionConfEntries(List<MultipleFileSelectionConfEntry> multipleFileSelectionConfEntries) {
        this.multipleFileSelectionConfEntries = multipleFileSelectionConfEntries;
    }
    
    
    
    @Override
    public int getRowCount() {
        return this.multipleFileSelectionConfEntries.size();
    }

    @Override
    public int getColumnCount() {
        return 3;
    }

    @Override
    public Object getValueAt(int i, int i1) {
        MultipleFileSelectionConfEntry entry=this.multipleFileSelectionConfEntries.get(i);
        switch(i1){
            case 0: return entry.getDisplayName();
            case 1: return entry.getLastSelectedFile();
            case 2: return null;
        };
        return null;
    }

    @Override
    public Class<?> getColumnClass(int i) {
        switch(i){
            case 0: return String.class;
            case 1: return String.class;
            case 2: return Object.class;
        };
        return null;
    }

    @Override
    public String getColumnName(int i) {
        switch(i){
            case 0: return "Name";
            case 1: return "File";
            case 2: return "";
        };
        return null;
    }

    @Override
    public boolean isCellEditable(int i, int i1) {
        return i1==2;
    }

    @Override
    public void setValueAt(Object o, int i, int i1) {
        MultipleFileSelectionConfEntry entry=this.multipleFileSelectionConfEntries.get(i);
        switch(i){
            case 0: entry.setDisplayName(""+o);break;
            case 1: entry.setLastSelectedFile(new File(""+o));
        };
        return;
    }
    
    
    
}
